package com.ravi;

import com.alibaba.fastjson.JSONArray;
import com.ravi.dao.CheckGroupDAO;
import com.ravi.entity.CheckGroup;
import com.ravi.vo.PatientGroupVo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class CheckGroupTEST {

	@Autowired
	private CheckGroupDAO checkGroupDAO;

	@Test
	public void selectPatientGroupVoTest() {
		Integer patientId = 1942;
		List<PatientGroupVo> patientGroupVos = checkGroupDAO.selectPatientGroupRecordsByPId(patientId);
		if (patientGroupVos.isEmpty()) {
			System.out.println("无记录");
		}else {
			for (PatientGroupVo patientGroupVo : patientGroupVos) {
				System.out.println(patientGroupVo);
			}
		}

	}


	@Test
	public void selectOneTest() {
		Integer id = 9;
		CheckGroup checkGroup = checkGroupDAO.selectCheckGroupById(id);
		System.out.println(checkGroup.getGroupName());
		JSONArray itemList = checkGroup.getItemList();
		for (int i = 0; i < itemList.size(); i++) {
			Integer itemId = itemList.getInteger(i);
			System.out.println(itemId);
		}
	}
}
